package com.citycloud.ccuap.tc.admin.repository;

import com.citycloud.ccuap.tc.admin.entity.SysDeptmentMerge;
import com.citycloud.ccuap.tc.yq.constant.YqConstant;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.mybatis.repository.support.MybatisRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 业务类型数据库操作
 * @author sufeng
 *
 */

@Repository
public interface SysDeptmentMergeRepository extends MybatisRepository<SysDeptmentMerge, Long> {
    
    @Cacheable(cacheNames = YqConstant.CACHE_KEY_CCUAP_SYS_DEPTMENTS, key = "#p0")
    List<SysDeptmentMerge> findAllByPid(Long pid);
    
    @Cacheable(cacheNames = YqConstant.CACHE_KEY_CCUAP_SYS_DEPTMENTS, key = "-1L")
    List<SysDeptmentMerge> findAllByPidIsNull();
    
    @CachePut(cacheNames = YqConstant.CACHE_KEY_CCUAP_SYS_DEPTMENTS, key = "#p0")
    List<SysDeptmentMerge> findListByPid(Long pid);
    
    @CachePut(cacheNames = YqConstant.CACHE_KEY_CCUAP_SYS_DEPTMENTS, key = "-1L")
    List<SysDeptmentMerge> findListByPidIsNull();
    
}